import { Component, OnInit} from '@angular/core';
import { Router } from '@angular/router';

@Component({
  selector: 'app-extract-dataset',
  templateUrl: './extract-dataset.component.html',
  styleUrls: ['./extract-dataset.component.scss']
})
export class ExtractDatasetComponent implements OnInit {
  listOfData: any = [];
  addVisible = false;
  importVisible = false;
  radioValue:any = '';
  sels:string = "";
  selarr=[];

  constructor(private router:Router) { }


  ngOnInit() {
    this.listOfData = new Array(100).fill(0).map((_, index) => {
      return {
        id: index,
        name: `cls-010-${index}`,        
        progress: index+50,
        createTime: '2021-05-04 18:12:32'
      };
    });
  }


  deleteRow(id: string) {
    this.listOfData = this.listOfData.filter(d => d.id !== id);
  }
  addDataset(){
    this.addVisible = true;

  }
  importDataset(){
    this.importVisible = true;
  }
  handleAddCancel(){
    this.addVisible = false;
  }
  handleImportCancel(){
    this.importVisible = false;
  }

  nextStep(){
    this.router.navigate(['/extract/extractModel']);
  }
  chkClick(e){
    if(e.target.checked){
      this.selarr.push(e.target.value);
    }else{
      this.selarr.splice(this.selarr.indexOf(e.target.value),1); 
    }
    this.sels = this.selarr.join();
    console.log(e.target.checked)
  }
}
